<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" dir="ltr">
<head>
#headTag("重设密码")
<style type="text/css">
.reset-password td {
	padding-bottom:5px;
}
.reset-password th {
	padding-bottom:5px;
	text-align:right;
}
input.submit{
	width:65px;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
	$('#password-reset1').submit(function(){
		$("input[type='submit']").attr("disabled", "disabled");
		var nickname = $("input[name=nickname]").val();
		var email = $("input[name=email]").val();
		var data = {nickname:nickname, email:email};
		$.post($(this).attr('action'), data, function(json){
			if(json.success){
				alert("请查收邮件");
			} else {
				alert(json.errors[0].message);
			}
			$("input[type='submit']").removeAttr("disabled");
		},"json");
		return false;
	});
	
	$('#password-reset2').submit(function(){
		$("input[type='submit']").attr("disabled", "disabled");
		var code = $("input[name=code]").val();
		var password = $("input[name=password]").val();
		var data = {code:code, password:password};
		$.post($(this).attr('action')+'?_method=PUT', data, function(json){
			if(json.success){
				alert("请查收邮件");
			} else {
				alert(json.errors[0].message);
			}
			$("input[type='submit']").removeAttr("disabled");
		},"json");
		return false;
	});
})
</script>
</head>
<body>
<div id="page">
#parse("default/_header.htm")
<div id="middle">
<div id="main_wrap">
	<div id="main">
		#topbar()
		<div class="center">
			<h1>重设密码</h1>
			<div class="content">
				<div class="reset-password">
					#if($code)
					<form action="$url.base/account/password/reset" method="post">
						<input type="hidden" value="$code" name="code"/>
						<input type="hidden" value="put" name="_method"/>
						<table>
							<tr>
								<th>重设密码：</th>
								<td><input type="password" value="" name="password"/></td>
							</tr>
							<tr>
								<td colspan="2" align="center"><input class="submit"  type="submit" value="提交"/></td>
							</tr>
						</table>
					</form>
					#else
					<form id="password-reset1" action="$url.base/account/password/reset" method="post">
						<table>
							<tr>
								<th>用户名：</th>
								<td><input type="text" value="" name="nickname"/></td>
							</tr>
							<tr>
								<th>邮箱：</th>
								<td><input type="text" value="" name="email"/></td>
							</tr>
							<tr>
								<td colspan="2" style="text-align:center"><input class="submit" type="submit" value="提交"/></td>
							</tr>
						</table>
					</form>
					#end
				</div>
			</div>
		</div>
	</div>
</div>
#parse("default/_sidebar.htm")
</div>
</div>
#parse("default/_footer.htm")
</body>
</html>